package com.ufo.algorithm.sorting;

public class MaxPQ <K extends Comparable<K>>{
    private K[] pq;
    private int N=0;
    public MaxPQ(int maxN)
    { pq = (K[]) new Comparable[maxN+1]; }
    public boolean isEmpty()
    { return N == 0; }
    public int size()
    { return N; }
    public void insert(K v)
    {
        pq[++N] = v;
        swim(N);
    }
    public K delMax()
    {
        K max = pq[1]; // Retrieve max key from top.
        exch(1, N--); // Exchange with last item.
        pq[N+1] = null; // Avoid loitering.
        sink(1); // Restore heap property.
        return max;
    }

    // See pages 145-147 for implementations of these helper methods.
    private boolean less(int i, int j) {
        return false;
    }

    private void exch(int i, int j) {

    }

    private void swim(int k) {

    }

    private void sink(int k) {

    }
}
